﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResourceEdit.aspx.cs" Inherits="Invoicing.Resources.ResourceEdit" %>

 <div class="pageContent">
    <form id="form1" method="post" action="AJAX/ResourceInfo.ashx" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone)">
        <input type="hidden" name="action" value="edit" />
        <input type="hidden" name="rid" value="<%= Model.po_id %>" />
        <div class="pageFormContent" layouth="50">
            <p>
                <label>菜单名称：</label>
                <input type="text" name="txtpWName" size="30" maxlength="50" class="required" alt="请输入名称" value="<%= Model.po_name %>" />
            </p>
            <p>
                <label>菜单路径：</label>
                <input type="text" name="txtpWPath" size="30" maxlength="150" class="required" alt="请输菜单路径" value="<%= Model.po_src %>" />
            </p>
            <p>
                <label>菜单类型：</label>
                <select name="potype" id="potype" class="combox">
                    <option value="1">数据操作</option>
                    <option value="2">统计查看</option>
                    <option value="3">资源访问</option>
                </select>

            </p>

            <p>
                <label>是否启用：</label>
                <input type="radio" name="pwstate" value="1" id="pwstate1" />启用
		        <input type="radio" name="pwstate" value="0"  id="pwstate0"/>禁用
            </p>

            <p>
                <label>是否根目录：</label>
                <input type="radio" name="pwisroot" value="1" id="pwisroot1" />是
		        <input type="radio" name="pwisroot" value="0" id="pwisroot0" />否

            </p>



            <p>
                <label>上级菜单：</label>
                <select class="combox" name="pwupid"  id="pwupid">
                    <option value="0">根目录</option>

                    <%
                        
                        foreach (System.Data.DataRow  item in Dataitems.Rows)
                        {
                            
                    %>

                    <option value="<%= item["po_id"].ToString() %>"><%= item["po_name"].ToString() %></option>
                    <%
                         }
                    %>

                </select>

            </p>

            <p>
                <label>菜单介绍：</label>
                <textarea name="pwnote" cols="20" style="width: 200px; text-align:left">

                    <%= Model.po_note %>

                </textarea>
            </p>
        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">提交</button></div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="button" class="close">取消</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
   <script type="text/javascript">
       //绑定类别
       var  potype=<%= Model.po_type%>
       var items = $("#potype> option");   
       items.each(function (i) {
           if (items[i].value==potype) {
               $(items[i]).attr("selected","selected")
           } 
       })

       var  pstate=<%= Model.po_state%>
           if (pstate==1) {
               $("#pwstate1").attr("checked","checked")
           }
       else{
               $("#pwstate0").attr("checked","checked")
       }

       var  pstate=<%= Model.po_isroot%>
           if (pstate==1) {
               $("#pwisroot1").attr("checked","checked")
           }
       else{
                 $("#pwisroot0").attr("checked","checked")   
       }

                 var upid=<%= Model.po_upid%>

                 var item2 = $("#pwupid> option");   
                 item2.each(function (i) {
                     if (item2[i].value==upid) {
                         $(item2[i]).attr("selected","selected")
                     } 
                 })
                 

    </script>